package com.yugao.fintech.antelope.auth.model;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yugao.fintech.antelope.base.model.BasePO;
import com.yugao.fintech.antelope.base.tenant.core.DataIsolation;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;

/**
 * 系统访问记录表 sys_login_log
 */
@Getter
@Setter
@ToString
@TableName("auth_login_log")
@DataIsolation(filterTenant = true, tableName = "auth_login_log")
public class AuthLoginLog extends BasePO {
    private static final long serialVersionUID = 1L;

    public static LambdaQueryWrapper<AuthLoginLog> lqw() {
        return Wrappers.lambdaQuery();
    }

    /**
     * ID
     */
    @TableId
    private Long id;

    /**
     * 客户端id
     */
    private String clientId;

    /**
     * 用户账号
     */
    private String userName;

    /**
     * 状态 0成功 1失败
     */
    private String status;

    /**
     * ip
     */
    private String ip;

    /**
     * 地点
     */
    private String location;

    /**
     * 用户系统
     */
    private String os;

    /**
     * 浏览器
     */
    private String browser;

    /**
     * 描述
     */
    private String msg;

    /**
     * 登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date loginTime;

    public AuthLoginLog() {
        this.loginTime = new Date();
    }
}